<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>优惠券统计</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">

    <meta http-equiv="Pragma"    content="no-cache"/>
     
    <meta http-equiv="Cache-Control"    content="no-cache"/>
     
    <meta http-equiv="Expires"    content="0"/>

    <link rel="stylesheet" href="/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="/layui/style/admin.css" media="all"/>
</head>
<body class="childrenBody">

<blockquote class="layui-elem-quote news_search">
    <div class="layui-inline queryTable">
        <label class="layui-form-label">查询时间:</label>
        <div class="layui-input-inline">
            <div class="layui-input-inline">
                <input type="text" name="queryTime" lay-verify="required" class="layui-input" id="queryTime"
                       placeholder="yyyy年MM月dd日">
            </div>
        </div>
        <a class="layui-btn search_btn ">查询</a>
    </div>
</blockquote>


<div class="layui-form-item">
    <div class="layui-inline" style="width: 350px">
        <label class="layui-form-label" style="width: 150px">
            活动数量:</label>
        <div class="layui-input-block">
            <input type="text" value="" lay-verify="number" id="activitys" name="activitys" disabled class="layui-input"
                   style="width: 150px;border: none;">
        </div>
    </div>
</div>

<div class="layui-form-item">
    <div class="layui-inline" style="width: 350px">
        <label class="layui-form-label" style="width: 150px">
            优惠券种数:</label>
        <div class="layui-input-block">
            <input type="text" value="" lay-verify="number" id="cpns" name="cpns" disabled class="layui-input"
                   style="width: 150px;border: none;">
        </div>
    </div>
</div>

<div class="layui-form-item">
    <div class="layui-inline" style="width: 350px">
        <label class="layui-form-label" style="width: 150px">
            优惠券领取数量:</label>
        <div class="layui-input-block">
            <input type="text" value="" lay-verify="number" id="cpnGets" name="cpnGets" disabled class="layui-input"
                   style="width: 150px;border: none;">
        </div>
    </div>
</div>

<div class="layui-form-item">
    <div class="layui-inline" style="width: 350px">
        <label class="layui-form-label" style="width: 150px">
            优惠券未领取数:</label>
        <div class="layui-input-block">
            <input type="text" value="" lay-verify="number" id="cpnNotGets" name="cpnNotGets" disabled
                   class="layui-input"
                   style="width: 150px;border: none;">
        </div>
    </div>
</div>

<div class="layui-form-item">
    <div class="layui-inline" style="width: 350px">
        <label class="layui-form-label" style="width: 150px">
            优惠券核销数量:</label>
        <div class="layui-input-block">
            <input type="text" value="" lay-verify="number" id="cpnCancels" name="cpnCancels" disabled
                   class="layui-input"
                   style="width: 150px;border: none;">
        </div>
    </div>
</div>

<script type="text/javascript" src="/js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="/js/common.js"></script>
<script type="text/javascript" src="/layui/layui.js"></script>
<script type="text/javascript" src="/js/MathUtils.js"></script>


<script type="text/javascript">


    layui.config({
        base: "/layui/"
    }).extend({
        index: 'lib/index'
    }).use(['index', 'form', 'jquery', 'upload', 'table', 'laydate', 'util'], function () {
        var form = layui.form,
            upload = layui.upload,
            laydate = layui.laydate,
            util = layui.util,
            admin = layui.admin;

        //日期时间选择器
        laydate.render({
            elem: '#queryTime'
            , format: 'yyyy年MM月dd日'
        });

        //查询统计
        $(".search_btn").click(function () {
            var queryTime = $("#queryTime").val();
            $.post(
                "/cpnStatistics/getStatistics",
                {'queryTime': queryTime},
                function (result) {
                    if (result.code == 1) {
                        $('#activitys').val(result.data.activitys);
                        $('#cpns').val(result.data.cpns);
                        $('#cpnGets').val(result.data.cpnGets);
                        $('#cpnNotGets').val(result.data.cpnNotGets);
                        $('#cpnCancels').val(result.data.cpnCancels);
                    } else {
                        layer.msg('网络忙稍后再试!!!');
                    }
                }
            )
        });
        /**
         * 页面加载完去查询今天数据
         */
        $(document).ready(function () {
            $("#queryTime").val(util.toDateString(new Date(), 'yyyy年MM月dd日'));
            $.post(
                "/cpnStatistics/getStatistics",

                function (result) {
                    if (result.code == 1) {
                        $('#activitys').val(result.data.activitys);
                        $('#cpns').val(result.data.cpns);
                        $('#cpnGets').val(result.data.cpnGets);
                        $('#cpnNotGets').val(result.data.cpnNotGets);
                        $('#cpnCancels').val(result.data.cpnCancels);
                    } else {
                        layer.msg('网络忙稍后再试!!!');
                    }
                }
            )

        });

    });

</script>


</body>
</html>